﻿using Festival_Locator.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.ModelBinding;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Festival_Locator
{
    public partial class FestivalDetail : BasePage //System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public IQueryable<Festivals> GetFestivals([QueryString("festivalID")] int? festivalID)
        {
            //we willen hier alle informatie van een festival tonen waarvan het id is meegegeven
            if (!festivalID.HasValue || festivalID.Value <= 0)
            {
                return null;
            }
            var _db = new Festival_Locator.Models.groep12_festivalsEntities();
            IQueryable<Festivals> query = _db.Festivals;
            if (festivalID.HasValue && festivalID.Value > 0)
            {
                query = query.Where(p => p.fest_id == festivalID);
            }
            return query;
        }

        public IQueryable<BandsPerFestival> GetBands([QueryString("festivalID")] int? festivalID)
        {
            //hier gaan we alle bands tonen die op het festival spelen
            if (!festivalID.HasValue || festivalID.Value <= 0)
            {
                return null;
            }
            var _db = new Festival_Locator.Models.groep12_festivalsEntities();
            IQueryable<BandsPerFestival> query = _db.BandsPerFestival;
            if (festivalID.HasValue && festivalID > 0)
            {
                query = query.Where(p => p.fest_id == festivalID);
            }
            return query;
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }
    }
}